I've found some great dxl on this forum and I thank you for that. I'm now able to ask a more educated question based on reviewing, modifying, and running some DXL.
Any recommendations or ideas would be greatly appreciated! Regards, Anthony SystemAdmin - Thu Sep 23 16:20:03 EDT 2010 |
Re: Pull metrics from multiple modules into a single "Project Metrics" module
I would probably do the following:
void setFilter (Module m, string filtStr) {
string code = "noError(); Module m = addr_ " ((addr_ m) int) "\ncurrent=m\nFilter f = " filtStr"\n; set f"
eval_ code;
}
Regexp reSplit = regexp ".*"
Skip splitLines (string s) {
Skip sk = create(); int count = 0;
while (!null s && reSplit s) { put (sk, count++, s[match 0] ""); s= s[end 0 + 2:]; }
return sk
}
bool existsAttr (Module m, string n) { AttrDef ad = find(m, n); return !null ad }
Module repMod = current
if (!isEdit repMod || !existsAttr (repMod, "Report Elements") || !existsAttr(repMod, "Evaluation List") ) {
ack "Start this script from a reports module opened in exclusive edit!"
halt
}
Skip skFilters = splitLines (repMod."Report Elements" "")
Skip skMods = splitLines (repMod."Evaluation List" "")
Object objReport = create repMod
objReport."Object Heading" = "Report from: " (dateAndTime today) ""
Regexp reFilter = regexp "^\\s*([^:]+):(.*)$"
string sMod, sRep;
for sMod in skMods do {
current = repMod
Object objResult = create last below objReport
Module evalMod = read(sMod, false, true)
objResult."Object Text" = fullName evalMod;
if (null evalMod) { print "Module " sMod " could not be opened. Skipping.\n"; continue }
for sRep in skFilters do {
if (reFilter sRep) {
string sAttr = sRep[match 1]
string sFilter = sRep[match 2]
noError()
int accepted = 0, rejected = 0
if (!existsAttr(repMod, sAttr)) { current = repMod; AttrDef ad = create object type "Integer" attribute sAttr }
setFilter (evalMod, sFilter);
current = evalMod
Filter f = current; set(evalMod, f, accepted, rejected)
string errMsg = lastError()
objResult.sAttr = accepted
if (!null errMsg) {
print "Could not evaluate '" sRep "' for '" sMod "'. Message: " errMsg
}
}
}
close evalMod; evalMod = null
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Pull metrics from multiple modules into a single "Project Metrics" module Mathias Mamsch - Fri Sep 24 17:48:28 EDT 2010
I would probably do the following:
void setFilter (Module m, string filtStr) {
string code = "noError(); Module m = addr_ " ((addr_ m) int) "\ncurrent=m\nFilter f = " filtStr"\n; set f"
eval_ code;
}
Regexp reSplit = regexp ".*"
Skip splitLines (string s) {
Skip sk = create(); int count = 0;
while (!null s && reSplit s) { put (sk, count++, s[match 0] ""); s= s[end 0 + 2:]; }
return sk
}
bool existsAttr (Module m, string n) { AttrDef ad = find(m, n); return !null ad }
Module repMod = current
if (!isEdit repMod || !existsAttr (repMod, "Report Elements") || !existsAttr(repMod, "Evaluation List") ) {
ack "Start this script from a reports module opened in exclusive edit!"
halt
}
Skip skFilters = splitLines (repMod."Report Elements" "")
Skip skMods = splitLines (repMod."Evaluation List" "")
Object objReport = create repMod
objReport."Object Heading" = "Report from: " (dateAndTime today) ""
Regexp reFilter = regexp "^\\s*([^:]+):(.*)$"
string sMod, sRep;
for sMod in skMods do {
current = repMod
Object objResult = create last below objReport
Module evalMod = read(sMod, false, true)
objResult."Object Text" = fullName evalMod;
if (null evalMod) { print "Module " sMod " could not be opened. Skipping.\n"; continue }
for sRep in skFilters do {
if (reFilter sRep) {
string sAttr = sRep[match 1]
string sFilter = sRep[match 2]
noError()
int accepted = 0, rejected = 0
if (!existsAttr(repMod, sAttr)) { current = repMod; AttrDef ad = create object type "Integer" attribute sAttr }
setFilter (evalMod, sFilter);
current = evalMod
Filter f = current; set(evalMod, f, accepted, rejected)
string errMsg = lastError()
objResult.sAttr = accepted
if (!null errMsg) {
print "Could not evaluate '" sRep "' for '" sMod "'. Message: " errMsg
}
}
}
close evalMod; evalMod = null
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Sorry the formatting in my post got messed up. You need to create two module attributes "Report Elements" and "Evaluation List" of type text and put the following text in there: Report Elements: (put 'attribute':'dxl filter expression' lines here, attributes will be created on first evaluation) # of Reqs: attribute "Requirement" == "TRUE" # of Orphans: attribute "Requirement" == "TRUE" && hasNoLinks(linkFilterOutgoing, "*") Evaluation List: (put the modules to be evaluated here) /MyProject/MyModule 1 /MyProject/MyModule 2
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Pull metrics from multiple modules into a single "Project Metrics" module Mathias Mamsch - Fri Sep 24 18:34:43 EDT 2010
Sorry the formatting in my post got messed up. You need to create two module attributes "Report Elements" and "Evaluation List" of type text and put the following text in there: Report Elements: (put 'attribute':'dxl filter expression' lines here, attributes will be created on first evaluation) # of Reqs: attribute "Requirement" == "TRUE" # of Orphans: attribute "Requirement" == "TRUE" && hasNoLinks(linkFilterOutgoing, "*") Evaluation List: (put the modules to be evaluated here) /MyProject/MyModule 1 /MyProject/MyModule 2
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
can anyone help me with this one. i have setup my modules as described and work briliantly! thanks mathias! i want to add in the last baseline number of each module to the output module. i have tried and tried and tried but cant get it to do it! thanks very much anyone! |
Re: Pull metrics from multiple modules into a single "Project Metrics" module SystemAdmin - Wed Aug 01 07:08:17 EDT 2012
Oh wow ... after two years this post finally draws someones attention ;-) Without trying I think you can just do: ... objResult."Object Text" = (fullName evalMod) (version evalMod) // <<-- added 'version evalMod' ...
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Pull metrics from multiple modules into a single "Project Metrics" module Mathias Mamsch - Wed Aug 01 12:07:57 EDT 2012
Oh wow ... after two years this post finally draws someones attention ;-) Without trying I think you can just do: ... objResult."Object Text" = (fullName evalMod) (version evalMod) // <<-- added 'version evalMod' ...
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
It works a treat! |
Re: Pull metrics from multiple modules into a single "Project Metrics" module Hi, Unfortunately I'm quite new in all is related to DOORS. So, maybe I will ask the most stupid question in the world: How can I create those 2 module attributes for Metrics Module? Every time when I try to create them, after I create the module attributes I can't add them to my View(in order to insert the path to my formal modules). I have to collect Metrics weekly for mote than 20 documents and all I succeed to create until now was a small DXL script that counts a single attribute from a single formal module: e.g. I'm in Module A and my script tells me that I have 150 reqs with Agreed status, 20 reqs with To Clarify status and 45 reqs with Not Agreed status. Can somebody help me?
Thanks |
Re: Pull metrics from multiple modules into a single "Project Metrics" module Cami - Sun Dec 14 15:19:56 EST 2014 Hi, Unfortunately I'm quite new in all is related to DOORS. So, maybe I will ask the most stupid question in the world: How can I create those 2 module attributes for Metrics Module? Every time when I try to create them, after I create the module attributes I can't add them to my View(in order to insert the path to my formal modules). I have to collect Metrics weekly for mote than 20 documents and all I succeed to create until now was a small DXL script that counts a single attribute from a single formal module: e.g. I'm in Module A and my script tells me that I have 150 reqs with Agreed status, 20 reqs with To Clarify status and 45 reqs with Not Agreed status. Can somebody help me?
Thanks A module attribute cannot be edited in the view ... A module attribute needs to be created over the attributes dialog, but then modified over File / Module Properties ... In the listview you can see the module attributes and then press a button or double click to edit. Regards, Mathias |